#!/bin/bash
{
#lld_port_tmp="$(ss -ant| awk '{if(NR>1) print $1,$2,$3,$4}')"
lld_port_log=/home/myzabbix/zabbix.lld.port.log
ss -ant| awk '{if(NR>1) print $1,$2,$3,$4}' > ${lld_port_log}   # NR>1表示不打印第一行

originData="$(awk -F':' '/LISTEN/{ p[$NF]++ } END{
for (i in p) print "{\"{#CONNPORT}\":\""i"\"}";
}' ${lld_port_log})"
} 2>/dev/null
# 生成Json格式
echo "[`echo ${originData}|sed 's/ /,/g'`]"